EvtHandler::DoMenuCommand
Section: ET++ method description (n)
Updated: automatically Fri Mar 15 14:09:27 1991
Index
Return to Main Contents
NAME
EvtHandler::DoMenuCommand - instance method
TEMPLATE
commandToExecute = Command *
DoMenuCommand(int commandId)
SPECIFIERS
public
virtual
DESCRIPTION
DoMenuCommand is called by the method VObject::DoRightButtonDownCommand when the user selected a command from a popup menu. The default implementation forwards DoMenuCommand to the next handler.
A typical implementation processes certain commands and passes remaining commands to the base classes and next handlers as shown in the following example:
Command *MyClass::DoMenuCommand (int commandId)
{
switch (commandId)
{
case cMENUCMD1: // create an undoable command
return new MenuCmd1(/* ... */);
case cMENUCMD2:
PerformMenuCmd2(); // execute menu command directly
break;
default: // pass other commands to base class
return MyBaseClass::DoMenuCommand(commandId);
}
return gNoChanges;
}
If the selected menu command causes changes, then an undoable command should be created. Other commands can be executed directly. See the method TextView::DoMenuCommand for a concrete example.
See also method GetMenu, method DoCreateMenu and method DoSetupMenu.
Method is often overridden.
ARGUMENTS
- int commandId
-
the id of the selected menu command
RETURN ARGUMENT
- Command * commandToExecute
-
a command to be executed or gNoChanges
CATEGORIES
menus, commands, event handling, overrider interface
FIRST DEFINITION
class EvtHandler
FILES
- implementation:
-
EvtHandler.C
Index
- NAME
-
- TEMPLATE
-
- SPECIFIERS
-
- DESCRIPTION
-
- ARGUMENTS
-
- RETURN ARGUMENT
-
- CATEGORIES
-
- FIRST DEFINITION
-
- FILES
-
This document was created by
man2html,
using the manual pages.
Time: 00:40:27 GMT, March 30, 2022